"""
URL configuration for buke project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.contrib.auth import views as auth_views
from journal import views as journal_views
from user import views as user_views

urlpatterns = [
    path('admin/', admin.site.urls),
    path("", journal_views.list_posts, name="post_list"),
    path("author/<single_sqids:user_id>/", journal_views.list_someones_posts, name="someones_post_list"),
    path("post/<single_sqids:id>/", journal_views.post_detail, name="post_detail"),
    path('post/write/', journal_views.write_post, name='write_post'),
    path('post/<single_sqids:id>/modify/', journal_views.modify_post, name='modify_post'),
    path('post/<single_sqids:id>/delete/', journal_views.delete_post, name='delete_post'),
    path('post/<single_sqids:id>/comment/', journal_views.write_comment, name='write_comment'),
    path('comment/<single_sqids:id>/delete/', journal_views.delete_comment, name='delete_comment'),
    path('comment/<single_sqids:id>/display/', journal_views.make_comment_display, name='make_comment_display'),
    path('like-post/', journal_views.like_post, name='like_post'),
    path('cancel-like-post/', journal_views.cancel_like_post, name='cancel_like_post'),
    path('login/', auth_views.LoginView.as_view(
        template_name='user/login.html',
        redirect_field_name='next'
    ), name='login'),
    path('logout/', auth_views.LogoutView.as_view(
        next_page='post_list'
    ), name='logout'),
    path('editorjs/', include('django_editorjs_fields.urls')),
    path('posts/<single_sqids:post_id>/increment-view/', journal_views.increment_view_count, name='increment_view_count'),
    path('user/profile/', user_views.profile, name='profile'),
    path("", include('journal.urls')),
    path("", include('user.urls')),
]
